package com.yangye.springclouddemokafka.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangye
 * @date 2020/07/16
 */
@RestController
public class ProducerController {

	@Autowired
	private KafkaTemplate kafkaTemplate;

	int i = 0;

	@GetMapping("/send")
	public String send(String msg) {
		kafkaTemplate.send("topic-test", "msg" + ++i);
		return "success";
	}

}
